// add flat = initializing, which indicates at what time
// should call init
// typically, call init at sub class create timing
// not call at super class create

var initializing = false;
function jClass(baseClass, prop) {
	if (typeof(baseClass) === "object") {
		prop = baseClass;
		baseClass = null;
	}
	function F() {
		if (!initializing) {
			this.init.apply(this, arguments);
		}
	}
	if (baseClass) {
		initializing = true;
		F.prototype = new baseClass(); // close init at super class create
		F.prototype.constructor = F;
		initializing = false;
	}
	for (var name in prop) {
		if (prop.hasOwnProperty(name)) {
			F.prototype[name] = prop[name];
		}
	}
	return F;
};
var Person = jClass({
	init: function(name) {
		this.name = name;
	},
	getName: function() {
		return this.name;
	}
});
var Employee = jClass(Person, {
	init: function(name, employeeID) {
		this.name = name;
		this.employeeID = employeeID;
	},
	getEmployeeID: function() {
		return this.employeeID;
	}
});
var e = new Employee("zs",123);
console.log(e.getName());
console.log(e.getEmployeeID());
